import {
  BaseEntity,
  Column,
  CreateDateColumn,
  DeleteDateColumn,
  Entity,
  OneToMany,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';
import { Inventoryplan } from './inventoryplan.entity';
import { Box } from './box.entity';
import { Outboundplan } from './outboundplan.entity';

@Entity()
export class Warehouse extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    comment: '名称',
    nullable: true,
    unique: false,
    default: null,
    type: 'varchar',
  })
  name: string;

  @OneToMany(() => Inventoryplan, (inventoryplan) => inventoryplan.warehouse)
  inventoryplans: Inventoryplan[];

  @OneToMany(() => Outboundplan, (outboundplan) => outboundplan.warehouse)
  outboundplans: Outboundplan[];

  @OneToMany(() => Box, (box) => box.warehouse)
  boxs: Box[];

  @CreateDateColumn()
  createTime: Date;

  @UpdateDateColumn()
  updateTime: Date;

  @DeleteDateColumn({ nullable: true })
  deleteTime: Date;
}
